package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.Tres;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TPrescriptionHistoryInfoMapper;
import com.ruoyi.system.domain.TPrescriptionHistoryInfo;
import com.ruoyi.system.service.ITPrescriptionHistoryInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 处方的药品信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-05-13
 */
@Service
public class TPrescriptionHistoryInfoServiceImpl implements ITPrescriptionHistoryInfoService 
{
    @Autowired
    private TPrescriptionHistoryInfoMapper tPrescriptionHistoryInfoMapper;

    /**
     * 查询处方的药品信息
     * 
     * @param id 处方的药品信息主键
     * @return 处方的药品信息
     */
    @Override
    public TPrescriptionHistoryInfo selectTPrescriptionHistoryInfoById(String id)
    {
        return tPrescriptionHistoryInfoMapper.selectTPrescriptionHistoryInfoById(id);
    }

    /**
     * 查询处方的药品信息列表
     * 
     * @param tPrescriptionHistoryInfo 处方的药品信息
     * @return 处方的药品信息
     */
    @Override
    public List<TPrescriptionHistoryInfo> selectTPrescriptionHistoryInfoList(TPrescriptionHistoryInfo tPrescriptionHistoryInfo)
    {
        return tPrescriptionHistoryInfoMapper.selectTPrescriptionHistoryInfoList(tPrescriptionHistoryInfo);
    }

    /**
     * 新增处方的药品信息
     * 
     * @param tPrescriptionHistoryInfo 处方的药品信息
     * @return 结果
     */
    @Override
    public int insertTPrescriptionHistoryInfo(TPrescriptionHistoryInfo tPrescriptionHistoryInfo)
    {
        tPrescriptionHistoryInfo.setAdd_date(DateUtils.getNowDate());
        tPrescriptionHistoryInfo.setAdd_time(DateUtils.getNowDate());
        return tPrescriptionHistoryInfoMapper.insertTPrescriptionHistoryInfo(tPrescriptionHistoryInfo);
    }

    /**
     * 修改处方的药品信息
     * 
     * @param tPrescriptionHistoryInfo 处方的药品信息
     * @return 结果
     */
    @Override
    public int updateTPrescriptionHistoryInfo(TPrescriptionHistoryInfo tPrescriptionHistoryInfo)
    {
        tPrescriptionHistoryInfo.setUpdateTime(DateUtils.getNowDate());
        return tPrescriptionHistoryInfoMapper.updateTPrescriptionHistoryInfo(tPrescriptionHistoryInfo);
    }

    /**
     * 批量删除处方的药品信息
     * 
     * @param ids 需要删除的处方的药品信息主键
     * @return 结果
     */
    @Override
    public int deleteTPrescriptionHistoryInfoByIds(String ids)
    {
        return tPrescriptionHistoryInfoMapper.deleteTPrescriptionHistoryInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除处方的药品信息信息
     * 
     * @param id 处方的药品信息主键
     * @return 结果
     */
    @Override
    public int deleteTPrescriptionHistoryInfoById(String id)
    {
        return tPrescriptionHistoryInfoMapper.deleteTPrescriptionHistoryInfoById(id);
    }

    @Override
    public List<TPrescriptionHistoryInfo> selectOtherHistoryInfoList(TPrescriptionHistoryInfo tPrescriptionHistoryInfo) {
        return tPrescriptionHistoryInfoMapper.selectOtherHistoryInfoList(tPrescriptionHistoryInfo);
    }

    @Override
    public List<TPrescriptionHistoryInfo> selectOtherHistoryInfoList1(TPrescriptionHistoryInfo tPrescriptionHistoryInfo) {
        return tPrescriptionHistoryInfoMapper.selectOtherHistoryInfoList1(tPrescriptionHistoryInfo);
    }

    public Tres getTodayAmount(){
        return tPrescriptionHistoryInfoMapper.getTodayAmount();
    }

    @Override
    public Tres getTodayTuikuanAmount() {
        return tPrescriptionHistoryInfoMapper.getTodayTuikuanAmount();
    }

}
